package practice;

import java.util.Scanner;

public class 买飞机票 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入机票的原价：");
        int ticket = sc.nextInt();
        System.out.print("请输入当前的月份");
        int month = sc.nextInt();
        System.out.print("请输入当前购买的仓位 0 头等舱 1 经济舱");
        int seat = sc.nextInt();
        if (month >= 5 && month <= 12) {
//            Printticket(seat,ticket,0.9,0.85);
            extracted(seat, ticket, 0.9, 0.85);
        } else if ((month >= 11 && month <= 12)
                || (month >= 1 && month <= 4)) {
//            Printticket(seat,ticket,0.70,0.65);
            extracted(seat, ticket, 0.7, 0.65);
        } else {
            System.out.println("输入的月份不合法");
        }
    }

    private static void extracted(int seat, int ticket, double x, double x1) {
        if (seat == 0) {
            System.out.println("你购买的头等舱价格为：" + ticket * x);
        } else if (seat == 1) {
            System.out.println("你购买的经济舱价格为：" + ticket * x1);
        } else {
            System.out.println("请输入真确的舱位");
        }
    }
//    public static void  Printticket(int seat, int ticket,double v0, double v1){
//        if(seat == 0) {
//            System.out.println("你购买的头等舱价格为：" + ticket * v0);
//        }else if(seat == 1) {
//            System.out.println("你购买的经济舱价格为：" + ticket * v1);
//        }else{
//            System.out.println("请输入真确的舱位");
//        }
//    }
}
